package com.craney.tempTest
{
	import flash.display.Shape;
	import flash.display.Sprite;
	import flash.display.Stage;
	import flash.geom.Point;
	
	public class TempTest
	{
		public function TempTest(stg:Stage)
		{
			// Position the shape at the top-left corner of the Stage, 
			// regardless of where its parent is located.
			
			// Create a Sprite, positioned at x:200 and y:200.
			var mySprite:Sprite = new Sprite();
			mySprite.x = 200;
			mySprite.y = 200;
			stg.addChild(mySprite);
			// Draw a dot at the Sprite's 0,0 coordinate, for reference.
			mySprite.graphics.lineStyle(1, 0x000000);
			mySprite.graphics.beginFill(0x000000);
			mySprite.graphics.moveTo(0, 0);
			mySprite.graphics.lineTo(1, 0);
			mySprite.graphics.lineTo(1, 1);
			mySprite.graphics.lineTo(0, 1);
			mySprite.graphics.endFill();
			
			// Create the circle Shape instance.
			var circle:Shape = new Shape();
			mySprite.addChild(circle);
			// Draw a circle with radius 50 and center point at x:50, y:50 in the Shape.
			circle.graphics.lineStyle(1, 0x000000);
			circle.graphics.beginFill(0xff0000);
			circle.graphics.drawCircle(50, 50, 50);
			circle.graphics.endFill();
			
			// Move the Shape so its top-left corner is at the Stage's 0, 0 coordinate.
			var stagePoint:Point = new Point(0, 0);
			var targetPoint:Point = mySprite.globalToLocal(stagePoint);
			circle.x = targetPoint.x;
			circle.y = targetPoint.y;
			trace(stagePoint);
			trace(targetPoint);
			trace(mySprite.localToGlobal(new Point(0, 0)));
		}

	}
}